<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    function f1()
    {console.log('f1')}
    f1();
    f1();
    f1();
    function f2(n)
    {console.log('f2');
    console.log(n)}
    f2(10);
    f2(true);
    f2('hello');

    //函数参数可多于给定参数，多余参数会被舍弃
    // 但少于给定参数时会报错 未被赋值的形参值为undefined
    function f3(n1,n2)
    {console.log('f3');
    console.log(n1+n2)}
// 返回值无法被直接调用，只能在输出里调用或定义变量保存结果再输出
    function f4(n1,n2)
    {console.log('f4');
        return n1+n2;}
    console.log(f4(10,20));
    let a=f4(10,20);
    console.log(a);
// 匿名函数自调用
    (function(){console.log('f');})();
//将函数整体赋值给f5变量，f5就相当于函数名
    var f5=function(){console.log('f5');};
    f5();
    f5();
    console.log(f5);
    console.log( typeof f5);

    //箭头函数
    const f6=()=>{console.log('f6');};
    f6();



</script>
</body>
</html>